package HomeWork.bufferedReader;


import exception.Student;

import java.io.FileOutputStream;
import java.io.IOException;


public class FinallyDemo {
    public static void main(String[] args)  {
//        System.out.println("start!!!!");
//
//        try {
//            String s="null";
//            System.out.println(s.length());
//            return;
//        } catch (NumberFormatException exception) {
//            System.out.println("caught!!");
//        }finally {
//            System.out.println("Anyway, I'll do it!!!");
//        }
//
//        System.out.println("end......");
//        System.out.println("Start!!");
//
//        try(FileOutputStream fos=new FileOutputStream("chat.txt")) {
//            fos.write(12);
//        } catch (IOException e) {
//            System.out.println("Solved.");
//        }finally {
//
//        }
//
//        System.out.println("End........");
        StudentExce stu=new StudentExce();
        try {
            stu.setAge(220);
            System.out.println("The age is: "+stu.getAge());
        } catch (RuntimeException exception) {
            System.out.println("The age is illegal");
        }
    }
}
